package com.ari.actions;

import org.apache.log4j.Logger;

import com.devicemantra.action.result.Result;
import com.devicemantra.coordinate.dao.SettingsDAO;
import com.google.gson.annotations.Expose;

public class EPPDDeleteServerAction {
	static final Logger logger = Logger.getLogger(EPPDDeleteServerAction.class);
	@Expose
	private final Result result = new Result();
	private String friendlyName;

	private SettingsDAO settingsDAO;

	/**
	 * @return
	 */
	public String execute() {
		try {
			Thread.sleep(1000);
		} catch (final InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		/* Hit the db now */
		settingsDAO.delete(getFriendlyName());
		result.setCode(0);
		result.setMessage("Successfully deleted server" + getFriendlyName());
		return "json";
	}

	public void validate() {
	}

	public void setSettingsDAO(final SettingsDAO settingsDAO) {
		this.settingsDAO = settingsDAO;
	}

	public String getFriendlyName() {
		return friendlyName;
	}

	public void setFriendlyName(final String friendlyName) {
		this.friendlyName = friendlyName;
	}

}
